package com.dingqb.ktdemo.oop.inherited

class expand {

}

open class User {
	open fun getName() {
		println("User getName")
	}
}

/**
定义类的扩展函数
扩展属于静态扩展
 **/
fun User.getExtendMethod() {
	println("expand User.getExtendMethod");

}

/**
扩展属性
 */
val User.extendField: Int
	get() = 100;

class UserA : User() {
	override fun getName() {
		println("UserA.getName")
	}
}

fun UserA.getExtendMethod() {
	println("expand UserA.getExtendMethod");
}


fun main(args: Array<String>) {

	var user = UserA();
	user.getName();
	user.getExtendMethod();
	println(user.extendField);

}
